package com.lmh.data;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Created by Liumh on 2018/5/25.
 */
public class DBConfigure {

    private static final String URL = "jdbc:mysql://118.190.79.7:3306/crawler?useUnicode=true&amp;characterEncoding=utf-8";
    private static final String USERNAME = "root";
    private static final String PASSWORD = "256515";

    private static Connection connection = null;

    static {
        try {
            //加载驱动程序
            Class.forName("com.mysql.jdbc.Driver");
            //获取数据库链接
            connection = DriverManager.getConnection(URL,USERNAME,PASSWORD);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public static Connection getConnection(){
        return connection;
    }
}
